package com.caigou.controller;

import com.caigou.bean.cms.param.AdContractParam;
import com.caigou.bean.exam.entity.Users;
import com.caigou.security.utils.CurrentUser;
import com.caigou.service.AdContractService;
import com.caigou.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@Api("广告合同管理器")
@RestController
@RequestMapping("/adContract/")
public class AdContractController {

    @Resource
    private AdContractService adContractService;

    @ApiOperation("获取广告合同列表")
    @RequestMapping("loadAdContractList")
    public Result loadAdContractList(@RequestBody AdContractParam param){
        return adContractService.loadAdContractList(param);
    }

    @ApiOperation("获取导出统计数据接口")
    @RequestMapping("loadAdContractExportList")
    public Result loadAdContractExportList(@RequestBody AdContractParam param){
        return adContractService.loadAdContractExportList(param);
    }

    @ApiOperation("删除广告合同数据")
    @RequestMapping("deleteAdContract")
    public Result deleteAdContract(@RequestBody AdContractParam param, @CurrentUser Users users){
        return adContractService.deleteAdContract(param,users);
    }

    @ApiOperation("获取合同新增--合同流水号计数器的值")
    @RequestMapping("loadAdContractSequence")
    public Result loadAdContractSequence(@CurrentUser Users users){
        return adContractService.loadAdContractSequence();
    }

    @ApiOperation("合同附件上传接口")
    @RequestMapping("uploadAdContractAdjunct")
    public Result uploadAdContractAdjunct(@RequestParam(value = "files") MultipartFile[] files){
        return adContractService.uploadAdContractAdjunct(files);
    }

    @ApiOperation("新增合同")
    @RequestMapping("saveAdContract")
    public Result saveAdContract(@RequestBody AdContractParam param, @CurrentUser Users users){
        return adContractService.saveAdContract(param,users);
    }

    @ApiOperation("获取合同详情页数据")
    @RequestMapping("loadAdContractInfo")
    public Result loadAdContractInfo(@RequestBody AdContractParam param){
        return adContractService.loadAdContractInfo(param);
    }

    @ApiOperation("附件删除")
    @RequestMapping("deleteAdContractAdjunct")
    public Result deleteAdContractAdjunct(@RequestBody AdContractParam param){
        return adContractService.deleteAdContractAdjunct(param);
    }

    @ApiOperation("新增附件")
    @RequestMapping("saveAdContractAdjunct")
    public Result saveAdContractAdjunct(@RequestBody AdContractParam param){
        return adContractService.saveAdContractAdjunct(param);
    }

    @ApiOperation("修改合同数据")
    @RequestMapping("updateAdContract")
    public Result updateAdContract(@RequestBody AdContractParam param, @CurrentUser Users users){
        return adContractService.updateAdContract(param,users);
    }
}
